package com.cn.shop.utils;

import lombok.Data;

import java.io.Serializable;

/**
 * 成功返回结果类
 *
 * @author suhao
 * @time 2017.09.18
 * @email suhao755@gmail.com
 */
@Data
public class ResultBean<T> implements Serializable {
    private static final long serialVersionUID = 1L;

    public static final int SUCCESS = 0;
    public static final int FAIL = 1;
    public static final int NO_PERMISSION = 2;

    public String msg = "success";

    private int code = SUCCESS;

    private T data;

    public ResultBean(){
        super();
    }
    public ResultBean(T data){
        super();
        this.data = data;
    }

    public ResultBean(T data, String msg){
        super();
        this.msg = msg;
        this.data = data;
    }

    public ResultBean(Throwable e){
        super();
        this.msg = e.toString();
        this.code = FAIL;
    }
}
